package com.ruoyi.web.controller.mstn;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MstnCatalystsCharts;
import com.ruoyi.system.service.IMstnCatalystsChartsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 催化剂图Controller
 * 
 * @author ruoyi
 * @date 2024-07-10
 */
@RestController
@RequestMapping("/catalyzer/charts")
public class MstnCatalystsChartsController extends BaseController
{
    @Autowired
    private IMstnCatalystsChartsService mstnCatalystsChartsService;

    /**
     * 查询催化剂图列表
     */
    @PreAuthorize("@ss.hasPermi('catalyzer:charts:list')")
    @GetMapping("/list")
    public TableDataInfo list(MstnCatalystsCharts mstnCatalystsCharts)
    {
        startPage();
        List<MstnCatalystsCharts> list = mstnCatalystsChartsService.selectMstnCatalystsChartsList(mstnCatalystsCharts);
        return getDataTable(list);
    }

    /**
     * 导出催化剂图列表
     */
    @PreAuthorize("@ss.hasPermi('catalyzer:charts:export')")
    @Log(title = "催化剂图", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MstnCatalystsCharts mstnCatalystsCharts)
    {
        List<MstnCatalystsCharts> list = mstnCatalystsChartsService.selectMstnCatalystsChartsList(mstnCatalystsCharts);
        ExcelUtil<MstnCatalystsCharts> util = new ExcelUtil<MstnCatalystsCharts>(MstnCatalystsCharts.class);
        util.exportExcel(response, list, "催化剂图数据");
    }

    /**
     * 获取催化剂图详细信息
     */
    @PreAuthorize("@ss.hasPermi('catalyzer:charts:query')")
    @GetMapping(value = "/{chartsId}")
    public AjaxResult getInfo(@PathVariable("chartsId") Long chartsId)
    {
        return success(mstnCatalystsChartsService.selectMstnCatalystsChartsBychartsId(chartsId));
    }

    /**
     * 新增催化剂图
     */
    @PreAuthorize("@ss.hasPermi('catalyzer:charts:add')")
    @Log(title = "催化剂图", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MstnCatalystsCharts mstnCatalystsCharts)
    {
        return toAjax(mstnCatalystsChartsService.insertMstnCatalystsCharts(mstnCatalystsCharts));
    }

    /**
     * 修改催化剂图
     */
    @PreAuthorize("@ss.hasPermi('catalyzer:charts:edit')")
    @Log(title = "催化剂图", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MstnCatalystsCharts mstnCatalystsCharts)
    {
        return toAjax(mstnCatalystsChartsService.updateMstnCatalystsCharts(mstnCatalystsCharts));
    }

    /**
     * 删除催化剂图
     */
    @PreAuthorize("@ss.hasPermi('catalyzer:charts:remove')")
    @Log(title = "催化剂图", businessType = BusinessType.DELETE)
	@DeleteMapping("/{chartsIds}")
    public AjaxResult remove(@PathVariable Long[] chartsIds)
    {
        return toAjax(mstnCatalystsChartsService.deleteMstnCatalystsChartsBychartsIds(chartsIds));
    }
}
